<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns active resources</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.get-resources" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_resources</h1>
  <p class="verinfo">(PHP 7)</p><p class="refpurpose"><span class="refname">get_resources</span> &mdash; <span class="dc-title">Returns active resources</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.get-resources-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>get_resources</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$type</code></span>
  ] ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Returns an array of all currently active <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>s, optionally
   filtered by resource type.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.get-resources-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">type</code></dt>

     <dd>

      <p class="para">
       If defined, this will cause <span class="function"><strong>get_resources()</strong></span> to only
       return resources of the given type.
       <a href="resource.html" class="link">A list of resource types is available.</a>
      </p>
      <p class="para">
       If the <span class="type"><a href="language.types.string.html" class="type string">string</a></span> <em>Unknown</em> is provided as
       the type, then only resources that are of an unknown type will be
       returned.
      </p>
      <p class="para">
       If omitted, all resources will be returned.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.get-resources-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of currently active resources, indexed by
   resource number.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.get-resources-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-503">
    <p><strong>Example #1 Unfiltered <span class="function"><strong>get_resources()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_resources</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(1) {
  [1]=&gt;
  resource(1) of type (stream)
}
</pre></div>
    </div>
   </div>
   <div class="example" id="example-504">
    <p><strong>Example #2 Filtered <span class="function"><strong>get_resources()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_resources</span><span style="color: #007700">(</span><span style="color: #DD0000">'stream'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_resources</span><span style="color: #007700">(</span><span style="color: #DD0000">'curl'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(1) {
  [1]=&gt;
  resource(1) of type (stream)
}
array(0) {
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.get-resources-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="get_loaded_extensions.html" class="function" rel="rdfs-seeAlso">get_loaded_extensions()</a> - 返回所有编译并加载模块名的 array</span></li>
    <li class="member"><span class="function"><a href="get_defined_constants.html" class="function" rel="rdfs-seeAlso">get_defined_constants()</a> - 返回所有常量的关联数组，键是常量名，值是常量值</span></li>
    <li class="member"><span class="function"><a href="get_defined_functions.html" class="function" rel="rdfs-seeAlso">get_defined_functions()</a> - 返回所有已定义函数的数组</span></li>
    <li class="member"><span class="function"><a href="get_defined_vars.html" class="function" rel="rdfs-seeAlso">get_defined_vars()</a> - 返回由所有已定义变量所组成的数组</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>